Ext.define('DCApp.model.CeAttachment', {
    extend: 'DCApp.model.BaseEntity',
    fields: [
        {name: 'id', type: 'int'},
        {name: 'name'},
        {name: 'purpose'},
        {name: 'nameUk'},
        {name: 'suffix'},
        {name: 'spec'},
        {name: 'filesize', type: 'int'},
        {name: 'download', type: 'int'},
        {name: 'path'},
        {name:'lastmod', type: 'date',  dateFormat: 'Y-m-d H:i:s'},
        {
            name: 'uri',
            calculate: function (data) {
              var path = data.path;
              var pid = data['id'];
              //sim data
              if(!path || !pid)
            	  return "";
              if(path.indexOf('path')==0){
            	  return '../imgs/'+pid % 5+'.jpg';
              }
              path = path.replace(/\\/g,'/');
        	  var uri_m = '/fileopen?_dc='+new Date().getTime()+'&'
            	  +Ext.Object.toQueryString({'fp':'/'+path});
        	  return uri_m;
            }
        },
        {
            name: 'uri_m',
            calculate: function (data) {
              var path = data.path;
              var pid = data['id'];
              //sim data
              if(!path || !pid)
            	  return '';
              if(path.indexOf('path')==0){
            	  return '../imgs/'+pid % 5+'.jpg';
              }

              path = path.replace(/\\/g,'/');
        	  var uri_m;
        	  //53上的附件
        	  var id = data['id'];
        	  if(id && id <DCApp.Cfg.ID_START)
        		  uri_m = DCApp.Cfg.WEB_ROOT_CC+'upload'+path;
        	  else
        		  uri_m = '/fileopen?_dc='+new Date().getTime()+'&'
            	  +Ext.Object.toQueryString({'fp':'/'+path});
        	  return uri_m;
            }
        }
    ],
    rmap:{
    	'suffix':['jpg','jpg','doc','xls','pdf','zip']
    }
});
